; void productoEscalar(int* v, int k, unsigned short n, long long int* w);

global productoEscalar

extern printf

%define ptr_v [ebp + 8]
%define k [ebp + 12]
%define n [ebp + 16]
%define ptr_w [ebp + 20]

section .text

productoEscalar:
	push ebp
	mov ebp, esp
	push esi
	push edi
	push ebx
	
	mov esi, ptr_v
	mov edi, ptr_w
	mov ebx, k
	xor ecx, ecx
	mov cx, n
	cmp ecx, 0
	je fin
	
	xor edx, edx
	
ciclo:
	mov eax, [esi + ecx * 4 - 4]
	mul ebx
	mov [edi + ecx * 8 - 8], eax
	mov [edi + ecx * 8 - 4], edx
	loop ciclo
	
fin:
	pop ebx
	pop edi
	pop esi
	pop ebp
	ret
